Shader "Level4/Fillscreen"{
	Properties{
		_MainTex("Base map",2d) = ""{}
	}
	
	CGINCLUDE
	#include "UnityCG.cginc"
	sampler2D _MainTex;
	
	struct v2f{
		float4 pos:POSITION;
		float2 uv : TEXCOORD0;
	};
	/**
		1.投影顶点坐标:
			获取顶点的符号作为,消化后的屏幕空间坐标.[-1,1]
		2.转换纹理坐标: 
			将[-1,1]转换为纹理空间的坐标[0,1]
			公式: 
				0.5 * ([-1,1] + 1)
	*/
	v2f vert(appdata_full data){
		v2f v;
		float2 posSign = sign(data.vertex.xy);
		v.pos = float4(posSign,0,1);
		// v.uv = 0.5 * (float2(posSign.x,-posSign.y)+1);
		v.uv = 0.5 * float2(posSign.x,-posSign.y) + 0.5;
		return v;
	}
	
	float4 frag(v2f v):COLOR0{
		float2 uv2 = float2(v.uv.x,v.uv.y + _Time.y);
		float4 c = tex2D(_MainTex,uv2);
		return c;
	}
	
	ENDCG
	
	SubShader{
		Pass{
			CGPROGRAM
			#pragma vertex vert
			#pragma fragment frag
			ENDCG
		}
	}
}